<template>
  <div>
    <xy-table
      ref="xy-table"
      :columns="columns"
      :api="api"
      :param="param"
      :addFormDTO="addForm"
    >
      <template slot="addItem">
        <search-header :model="param" :on-search="onSearch">
          <template #operation>
            <el-form-item>
              <el-button
                icon="el-icon-plus"
                type="default"
                @click="toDetail"
                size="mini"
                >{{ $language.local("refund") }}</el-button
              >
            </el-form-item>
          </template>
        </search-header>
      </template>
    </xy-table>
  </div>
</template>

<script>
import API from "../../plugins/api";

export default {
  name: "payroll",

  data() {
    return {
      api: new API("/api/refund"),
      columns: {
        // BusinessOrderNo: "",
        // BankOrderNo: "",
        // AccountrechargeId: 0,
        refundAmount: 100,
        refundRechargeAmount: 106.38,
        CanrefundAmount: 6400,
        refundReason: "退款说明",
        Indate: "1900-01-01T00:00:00",
        Status: 0,
        // userId: 0,
        // SID: 4,
        // MID: 177,
        //  MName: "",
        // refundType: 2,
        // ServiceBank: "中国银行郴州市中山北街支行",
        // ServiceAccountNo: "585975598300",
      },
      addForm: {
        SID: "",
        MID: "",
        ServiceBank: "",
        ServiceAccountNo: "",
        refundType: "",
        CanrefundAmount: "",
        refundAmount: "",
        refundRechargeAmount: "",
        refundReason: "",
        AttFileUrl: "",
        Indate: new Date(),
      },
      addFormKeys: {
        SID: 0,
        MID: 0,
        ServiceBank: "充值银行",
        ServiceAccountNo: "充值账号",
        refundType: "退款类型",
        CanrefundAmount: "可退款金额",
        refundAmount: "退款金额",
        refundRechargeAmount: "应退金额（含服务费）",
        refundReason: "退款说明",
        AttFileUrl: "申请函附件",

        // BankOrderNo: "充值银行",
        // AccountrechargeId: "充值账号",
        //  CheckDate: "string",
        // Indate: "2021-06-04T02:43:33.220Z",
        //   Status: 0,
        //    userId: 0,

        //  MName: "string",
      },
      services: [],
      param: {
        BeginDate: "",
        EndDate: "",
        Status: "",
      },
    };
  },
  created() {},
  methods: {
    onSearch(e) {
      // this.param.BeginDate = this.param.date[0].toLocaleDateString();
      // this.param.EndDate = this.param.date[1].toLocaleDateString();
      console.log(e);
      this.$refs["xy-table"].getData(e);
    },

    toDetail() {
      window.sessionStorage.setItem(
        this.api.entity,
        JSON.stringify(this.addForm)
      );
      this.$router.push({
        path: "/detail",
        query: {
          api: this.api.create,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped></style>
